// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   BookmarkServiceMock.java

package dale.web.bookmark.service;

import dale.web.bookmark.vo.BookmarkVo;
import java.util.*;
import org.apache.commons.lang.StringUtils;

// Referenced classes of package dale.web.bookmark.service:
//            BookmarkService

public class BookmarkServiceMock
    implements BookmarkService
{

    public BookmarkServiceMock()
    {
        list = new ArrayList();
        for(int i = 0; i < 100; i++)
        {
            BookmarkVo vo = new BookmarkVo();
            vo.setBookmarkNo(Integer.valueOf(i));
            vo.setUrl((new StringBuilder("http://www.naver.com/news/detail-")).append(i).toString());
            vo.setTitle((new StringBuilder("\uB124\uC774\uBC84 \uB274\uC2A4 ")).append(i).append("bu").toString());
            vo.setUsername("dale0713");
            vo.setPassword("2001k5530");
            vo.setHit(Integer.valueOf((new Random()).nextInt()));
            list.add(vo);
        }

    }

    public BookmarkVo detail(Integer id)
    {
        return (BookmarkVo)list.get(id.intValue());
    }

    public List search(BookmarkVo vo)
    {
        List result = new ArrayList();
        for(Iterator iterator = list.iterator(); iterator.hasNext();)
        {
            BookmarkVo item = (BookmarkVo)iterator.next();
            if(StringUtils.contains(item.getTitle(), vo.getTitle()))
                result.add(item);
        }

        return result;
    }

    public void create(BookmarkVo vo)
    {
        if(!list.add(vo))
            throw new RuntimeException("Failed to create a bookmark");
        else
            return;
    }

    public void modify(BookmarkVo bookmarkvo)
    {
    }

    public void delete(Integer integer)
    {
    }

    private List list;
}
